﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace Model
{
    /// <summary>
    /// 任务
    /// </summary>
    public class Task:TdyxObjects
    {
        protected string addressName;
		protected string monsterName;
		protected int monsterAmount=1;
        private bool completed = false;

        /// <summary>
        /// 任务是否已完成
        /// </summary>
        [XmlIgnore]
        public bool Completed
        {
            get { return completed; }
            set { completed = value; }
        }

        /// <summary>
        /// 任务进行所在地址
        /// </summary>
        public string AddressName
        {
            get { return addressName; }
            set { addressName = value; }
        }

        /// <summary>
        /// 任务完成需要杀死的怪物
        /// </summary>
        public string MonsterName
        {
            get { return monsterName; }
            set { monsterName = value; }
        }

        /// <summary>
        /// 任务完成需要杀死的怪物的数量
        /// </summary>
        public int MonsterAmount
        {
            get { return monsterAmount; }
            set { monsterAmount = value; }
        }

        /// <summary>
        /// 构造一个任务
        /// </summary>
        /// <param name="name">任务名称</param>
        /// <param name="addressName">任务进行所在地址</param>
        /// <param name="code">任务代码</param>
        public Task(string name,byte[] code, string addressName,string monsterName ):base(name,code)
        {
            this.addressName = addressName;
			this.monsterName = monsterName;
        }

        /// <summary>
        /// 构造一个任务
        /// </summary>
        /// <param name="name">任务名称</param>
        /// <param name="code">任务代码</param>
        public Task(string name, byte[] code):base(name,code)
        {

        }

		/// <summary>
        /// 构造一个任务
        /// </summary>
        public Task()
        {

        }
    }

    public class ExpTask : Task
    {
        private ExpTaskColor color;
        private int sequence;

        /// <summary>
        /// 循环经验任务的颜色
        /// </summary>
        public ExpTaskColor Color
        {
            get { return color; }
            set { color = value; }
        }
        
        /// <summary>
        /// 循环经验任务的当前次数
        /// </summary>
        public int Sequence
        {
            get { return sequence; }
            set { sequence = value; }
        }

        public ExpTask() { }

        /// <summary>
        /// 根据给定的Task和color,sequence构造一个ExpTask
        /// </summary>
        /// <param name="task">任务</param>
        /// <param name="color">循环经验任务的颜色</param>
        /// <param name="sequence">循环经验任务的次数</param>
        /// <returns></returns>
        public ExpTask (Task task,ExpTaskColor color,int sequence)
        {
            this.addressName = task.AddressName;
            this.code = task.Code;
            this.color = color;
            this.id = task.ID;
            this.monsterAmount = task.MonsterAmount;
            this.monsterName = task.MonsterName;
            this.name = task.Name;
            this.sequence = sequence;
        }
    }
    /// <summary>
    /// 循环经验任务的颜色
    /// </summary>
    public enum ExpTaskColor
    {
        /// <summary>
        /// 白色任务
        /// </summary>
        白色=1,
        /// <summary>
        /// 绿色任务
        /// </summary>
        绿色,
        /// <summary>
        /// 蓝色
        /// </summary>
        蓝色,
        /// <summary>
        /// 紫色
        /// </summary>
        紫色,
        /// <summary>
        /// 橙色
        /// </summary>
        橙色
    }
}
